import 'dart:convert' show json;

class CategoryParentBeanResult {

  int? code;
  String? msg;
  List<CategoryParentBean?>? data;

  CategoryParentBeanResult.fromParams({this.code, this.msg, this.data});

  factory CategoryParentBeanResult(Object jsonStr) => jsonStr is String ? CategoryParentBeanResult.fromJson(json.decode(jsonStr)) : CategoryParentBeanResult.fromJson(jsonStr);

  static CategoryParentBeanResult? parse(jsonStr) => ['null', '', null].contains(jsonStr) ? null : CategoryParentBeanResult(jsonStr);

  CategoryParentBeanResult.fromJson(jsonRes) {
    code = jsonRes['code'];
    msg = jsonRes['msg'];
    data = jsonRes['data'] == null ? null : [];

    for (var dataItem in data == null ? [] : jsonRes['data']){
      data!.add(dataItem == null ? null : CategoryParentBean.fromJson(dataItem));
    }
  }

  @override
  String toString() {
    return '{"code": $code, "msg": ${msg != null?'${json.encode(msg)}':'null'}, "data": $data}';
  }

  String toJson() => this.toString();
}

class CategoryParentBean {

  String? category_icon;
  int? id;
  int? parent_id;
  String? category_name;
  List<CategoryChildBean?>? data;

  CategoryParentBean.fromParams({this.category_icon, this.id, this.parent_id, this.category_name, this.data});

  CategoryParentBean.fromJson(jsonRes) {
    category_icon = jsonRes['category_icon'];
    id = jsonRes['id'];
    parent_id = jsonRes['parent_id'];
    category_name = jsonRes['category_name'];
    data = jsonRes['data'] == null ? null : [];

    for (var dataItem in data == null ? [] : jsonRes['data']){
      data!.add(dataItem == null ? null : CategoryChildBean.fromJson(dataItem));
    }
  }

  @override
  String toString() {
    return '{"category_icon": ${category_icon != null?'${json.encode(category_icon)}':'null'}, "id": $id, "parent_id": $parent_id, "category_name": ${category_name != null?'${json.encode(category_name)}':'null'}, "data": $data}';
  }

  String toJson() => this.toString();
}

class CategoryChildBean {

  int? id;
  int? parent_id;
  String? category_icon;
  String? category_name;

  CategoryChildBean.fromParams({this.id, this.parent_id, this.category_icon, this.category_name});

  CategoryChildBean.fromJson(jsonRes) {
    id = jsonRes['id'];
    parent_id = jsonRes['parent_id'];
    category_icon = jsonRes['category_icon'];
    category_name = jsonRes['category_name'];
  }

  @override
  String toString() {
    return '{"id": $id, "parent_id": $parent_id, "category_icon": ${category_icon != null?'${json.encode(category_icon)}':'null'}, "category_name": ${category_name != null?'${json.encode(category_name)}':'null'}}';
  }

  String toJson() => this.toString();
}